from pyecharts import options as opts
import pandas as pd
from pyecharts.charts import Line
from pyecharts.faker import Faker
import numpy as np
import csv

data_df = pd.read_csv('data_bilibili.csv', encoding = "GBK")
x = list(data_df['哔哩哔哩号'])
x = list(map(str, x))
y = list(data_df['播放量增量'])
c=(
    Line()
        .add_xaxis(x)
        .add_yaxis("UP主播放量增量图表", y, color='#6950a1')
        .set_global_opts(
        title_opts=opts.TitleOpts(title="Bar"),
        datazoom_opts=[opts.DataZoomOpts(), opts.DataZoomOpts(type_="inside")],
    )
    .set_series_opts(
        label_opts=opts.LabelOpts(is_show=False),
        markline_opts=opts.MarkLineOpts(
            data=[
                opts.MarkLineItem(type_="max", name="最大值"),
                opts.MarkLineItem(type_="min", name="最小值"),
                opts.MarkLineItem(type_="average", name="平均值"),
            ]
        ),
    )


    .render("2447.html")
 )


print('数据可视化结果完成,请在当前目录下查找打开 2447.html 文件!')

df = pd.read_csv('/Users/www14/Desktop/Python/senior/python_senior-master/python_senior-master/expiration/data_bilibili2.csv',)
data = pd.read_csv('data_bilibili2.csv', sep=',', encoding='GB18030').reset_index()




print(data)

# -*- coding=utf-8 -*-

p = r'/Users/www14/Desktop/Python/senior/python_senior-master/python_senior-master/expiration/data_bilibili2.csv'

with open(p,encoding = 'GB18030') as f:
    data = np.loadtxt(f,str,delimiter = ",", skiprows = 1)
    print(data[:5])


